﻿#pragma once


namespace micro{
namespace gui{


class QGdiObject
{
	// No copy constructor.
	//_NO_COPY( QGdiObject );
public:
	// Constructor.
	QGdiObject( HGDIOBJ hGdiObject = nullptr, bool bDestroy = true );

	// Destructor.
	virtual ~QGdiObject();

	// Interface.
	virtual void Delete();
	bool DeleteObject();
	void Attach( HGDIOBJ hGdiObject, bool bDestroy = true);
	HGDIOBJ Detach();
	bool IsValid();
	static QGdiObject *FromHandle( HGDIOBJ hGdiObject );
	 
	// Operator overload.
	operator HGDIOBJ() const;

protected:
	// Protected interface routines.
	int GetObject( int cbSize, LPVOID pStorage ) const;
	
	// Data
	HGDIOBJ	m_hGdiObject;
	bool	m_bDestroy;
};



}}//micro